﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;

namespace FierceWar
{
	public class KeyboardInput
	{
		public static KeyboardState lastState;
		public static KeyboardState currentState;

		public static void Update()
		{
			lastState = currentState;
			currentState = Keyboard.GetState();
		}

		public static bool IsKeyUp(Keys key)
		{
			return currentState.IsKeyUp(key);
		}

		public static bool IsKeyDown(Keys key)
		{
			return currentState.IsKeyDown(key);
		}

		public static bool IsKeyPressed(Keys key)
		{
			return (lastState.IsKeyUp(key) &&
				currentState.IsKeyDown(key));
		}

		public static bool IsKeyReleased(Keys key)
		{
			return (lastState.IsKeyDown(key) &&
				currentState.IsKeyUp(key));
		}
	}
}
